2
2
.
.
1
1
.
.
5
5
S
S
t
t
a
a
t
t
e
e
m
m
e
e
n
n
t
t
s
s
-
-
L
L
o
o
o
o
p
p
I
I
n
n
f
f
o
o
Loop Statements execute its Body multiple times (while condition is TRUE or while iterating through Elements)
for Statement iterates through Sequence or Array Elements and executes its Body for each Element.
while Statement executes its Body while condition is TRUE. Condition is checked at the beginning of Body
do ... while Statement executes its Body while condition is TRUE. Condition is checked at the end of Body.
You can use
break Jump Statement to exit Loop Statement
continue Jump Statement to skip rest of the Body and continue with next iteration from the beginning of Body
for
for(int i=1, j=5 ; i<=4 && j>2 ; i++, j--){
System.out.println(i);
}
while
while(i<=4) {
i++;
System.out.println(i);
}
do ... while
do{
i++;
System.out.println(i);
}while(i<=4);